package com.ruoyi.common.baseImg;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class CreateFileCommon {
    /**
     * 生成年文件夹，月文件夹
     * 进行按照日期进行文件的存储
     */
    public static void createFile(){
        for(int i = 2023;i <= 2100;i++){
            Path path = Paths.get("D:\\year\\"+i);
            try {
                Path pathCreate = Files.createDirectories(path);//.createDirectorys(path);
            } catch (IOException e) {
                e.printStackTrace();
            }
            for(int j = 1;j <= 12;j++){
                String filename = "";
                if(j < 10){
                    filename = "0"+j;
                }else{
                    filename = j+"";
                }
                path = Paths.get("D:\\year\\"+i+"\\"+filename);
                try {
                    Path pathCreate = Files.createDirectories(path);//.createDirectorys(path);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    public static void main(String[] args) {
        // System.out.println(DateUtils.datePathByYearMonth());
        createFile();
    }

}
